import { ref, Ref } from 'vue'

interface MemoPassword {
  memoVal: Ref<boolean>,
  onMemoPassWord: (value: boolean) => void
}

function useMemoPassword(): MemoPassword {
  const memoVal: Ref<boolean> = ref(localStorage.getItem('memoPassword') === 'true');
  
  const onMemoPassWord = (value: boolean) => {
    localStorage.setItem('memoPassword', String((memoVal.value = value)))
  }

  return {
    memoVal,
    onMemoPassWord
  }
}

export default useMemoPassword;